<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neo4j SPO关系可视化</title>
    <script src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/graph.css') }}">
</head>
<body>
    <div class="container">
        <header>
            <h1>📊 SPO关系可视化</h1>
            <div class="header-controls">
                <button onclick="loadAllSPO()">加载所有SPO</button>
                <button onclick="loadVisualization()">可视化展示</button>
                <button onclick="loadMetadata()">查看元数据</button>
            </div>
        </header>

        <div class="filter-panel">
            <h3>🔍 过滤器</h3>
            <div class="filter-controls">
                <select id="startLabelFilter">
                    <option value="">所有起始节点类型</option>
                </select>
                <select id="relTypeFilter">
                    <option value="">所有关系类型</option>
                </select>
                <select id="endLabelFilter">
                    <option value="">所有目标节点类型</option>
                </select>
                <input type="text" id="searchFilter" placeholder="搜索节点名称...">
                <button onclick="applyFilters()">应用过滤</button>
                <button onclick="clearFilters()">清除过滤</button>
            </div>
        </div>

        <div class="main-content">
            <div class="data-panel">
                <h3>📋 SPO关系数据 <span id="dataCount">(0 条记录)</span></h3>
                <div class="table-container">
                    <table id="spoTable">
                        <thead>
                            <tr style="text-align: center">
                                <th>起始节点</th>
                                <th>关系</th>
                                <th>目标节点</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="spoTableBody" style="text-align: center"></tbody>
                    </table>
                </div>
            </div>

            <div class="visualization-panel">
                <h3>📈 知识图谱</h3>
                <div id="network" class="network-container"></div>
            </div>
        </div>

        <div class="info-panel" id="infoPanel">
            <div class="panel-header">
                <h3>详细信息</h3>
                <button class="close-btn" onclick="hideInfoPanel()">×</button>
            </div>
            <div class="panel-content" id="panelContent"></div>
        </div>

        <div class="status-bar" id="statusBar">
            🟢 就绪 - 点击按钮加载数据
        </div>
    </div>

    <script src="{{ url_for('static', filename='js/graph.js') }}"></script>
</body>
</html>